package acm.蓝桥杯;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.StreamTokenizer;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Set;

public class F星际旅行2 {
    /**
     * 一个无向无权图
     * q次询问，求出每次能到达的所有点。
     * 对所有点求个和，取个均值
     */
    static int n, m, q;
    static int maxN = 1010, maxM = 50000, maxQ = 50000;
    static List<Integer>[] list;
    static int[] queue = new int[maxN * 2];
    static int[][] sum = new int[maxN * 5][maxN * 5];

    public static void main(String[] args) {
        Reader2 sc = new Reader2();
        n = sc.nextInt();
        m = sc.nextInt();
        q = sc.nextInt();
        list = new List[n + 1];
        for (int i = 1; i < list.length; i++) {
            list[i] = new ArrayList<>();
        }
        for (int i = 0; i < m; i++) {
            int u = sc.nextInt();
            int v = sc.nextInt();
            list[u].add(v);
            list[v].add(u);
        }
        for (int i = 1; i <= n; i++) {
            bfs(i);
        }
        for (int i = 1; i <= n; i++) {
            for (int j = 1; j <= n; j++) {
                sum[i][j] += sum[i][j - 1];
            }
        }
        long count = 0;
        for (int i = 0; i < q; i++) {
            int s = sc.nextInt();
            int step = sc.nextInt();
            count += sum[s][step];
        }
        System.out.printf("%.2f", 1.0 * count / q);
    }

    public static int bfs(int s) {
        int h = 0, t = 0;
        queue[t++] = s;
        Set<Integer> set = new HashSet<>();
        set.add(s);
        int level = 0;
        while (h != t) {
            int size = (t - h + queue.length) % queue.length;
            sum[s][level] = size;
            level++;
            for (int i = 0; i < size; i++) {
                int cur = queue[h++];
                for (Integer to : list[cur]) {
                    if (set.contains(to)) continue;
                    set.add(to);
                    queue[t++] = to;
                }
            }
        }
        return set.size();
    }

    static
    class Reader2 {
        private StreamTokenizer in = new StreamTokenizer(new BufferedReader(new InputStreamReader(System.in)));

        public int nextInt() {
            try {
                in.nextToken();
            } catch (IOException e) {
                e.printStackTrace();
            }
            return (int) in.nval;
        }

        public double nextDouble() {
            try {
                in.nextToken();
            } catch (IOException e) {
                e.printStackTrace();
            }
            return in.nval;
        }
    }
}
